package com.qingxin.park.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;

/**
 * 物资表
 */
@Entity
@Table(name = "material")
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class Material extends com.qingxin.sys.entity.BaseEntity implements
		java.io.Serializable {
	private static final long serialVersionUID = -2808778591956483318L;
	// Fields

	private String materialid;
	private FarmPark farmPark;
	private MaterialType materialType;
	private String materialCode;
	private String materialName;
	private String pbn;
	private String factory;
	private String isdeleted;
	private String units;
	private String materialImg;
	private String remark;
	private String createBy;
	private Date createTime;
	private String updateBy;
	private Date updateTime;

	// Constructors

	/** default constructor */
	public Material() {
	}
	public Material(String materialid) {
		this.materialid = materialid;
	}


	public Material(String materialid, String materialName) {
		this.materialid = materialid;
		this.materialName = materialName;
	}
	public Material(String materialid, String materialCode, String materialName, String pbn,
			String units, String factory, Date createTime, String typeName, String parkName) {
		this.materialid = materialid;
		this.materialCode = materialCode;
		this.materialName = materialName;
		farmPark = new FarmPark(null,parkName);
		this.pbn = pbn;
		this.units = units;
		this.factory = factory;
		this.createTime = createTime;
		materialType = new MaterialType();
		materialType.setTypeName(typeName);
	}

	
	

	/** full constructor */
	public Material(FarmPark farmPark, MaterialType materialType,
			String materialCode, String materialName, String pbn,
			String factory, String isdeleted, String units, String materialImg, String remark,
			String createBy, Date createTime, String updateBy,
			Date updateTime) {
		this.farmPark = farmPark;
		this.materialType = materialType;
		this.materialCode = materialCode;
		this.materialName = materialName;
		this.pbn = pbn;
		this.factory = factory;
		this.isdeleted = isdeleted;
		this.units = units;
		this.materialImg = materialImg;
		this.remark = remark;
		this.createBy = createBy;
		this.createTime = createTime;
		this.updateBy = updateBy;
		this.updateTime = updateTime;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "materialid", unique = true, nullable = false, length = 32)
	public String getMaterialid() {
		return this.materialid;
	}

	public void setMaterialid(String materialid) {
		this.materialid = materialid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parkid", nullable = false)
	public FarmPark getFarmPark() {
		return this.farmPark;
	}

	public void setFarmPark(FarmPark farmPark) {
		this.farmPark = farmPark;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "typeid", nullable = false)
	public MaterialType getMaterialType() {
		return this.materialType;
	}

	public void setMaterialType(MaterialType materialType) {
		this.materialType = materialType;
	}

	@Column(name = "material_code", length = 20)
	public String getMaterialCode() {
		return this.materialCode;
	}

	public void setMaterialCode(String materialCode) {
		this.materialCode = materialCode;
	}

	@Column(name = "material_name", length = 50)
	public String getMaterialName() {
		return this.materialName;
	}

	public void setMaterialName(String materialName) {
		this.materialName = materialName;
	}

	@Column(name = "pbn", length = 50)
	public String getPbn() {
		return this.pbn;
	}

	public void setPbn(String pbn) {
		this.pbn = pbn;
	}

	@Column(name = "factory", length = 100)
	public String getFactory() {
		return this.factory;
	}

	public void setFactory(String factory) {
		this.factory = factory;
	}

	@Column(name = "isdeleted", length = 1)
	public String getIsdeleted() {
		return this.isdeleted;
	}

	public void setIsdeleted(String isdeleted) {
		this.isdeleted = isdeleted;
	}

	@Column(name = "units", length = 20)
	public String getUnits() {
		return this.units;
	}

	public void setUnits(String units) {
		this.units = units;
	}

	@Column(name = "material_img", length = 100)
	public String getMaterialImg() {
		return materialImg;
	}
	public void setMaterialImg(String materialImg) {
		this.materialImg = materialImg;
	}
	
	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "create_by", length = 32)
	public String getCreateBy() {
		return this.createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	@Column(name = "create_time", length = 23)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_by", length = 32)
	public String getUpdateBy() {
		return this.updateBy;
	}

	public void setUpdateBy(String updateBy) {
		this.updateBy = updateBy;
	}

	@Column(name = "update_time", length = 23)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

}